using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
namespace CoreData
{
    public class groups
    {
            public long id{get;set;}
            public string name{get;set;}
            public string description{get;set;}
            public bool active{get;set;}
         
        public groups()
        {       
                    name ="";   
                    description ="";   
        }
        
       static groups DynamicCast<T>(object row_data, object row_header) where T : groups
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           groups ret = new groups();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "id":
                        ret.id = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "name":
                        ret.name = ConvertObject.ToString(dt[column]);
                       break;
                      case  "description":
                        ret.description = ConvertObject.ToString(dt[column]);
                       break;
                      case  "active":
                        ret.active = ConvertObject.ToBool(dt[column]);
                       break;
                
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
